package groupb6.shopsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import groupb6.shopsystem.pojo.entity.OrderProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderProductMapper extends BaseMapper<OrderProduct> {
    @Select("SELECT * FROM tb_order_product WHERE order_id = #{orderId}")
    List<OrderProduct> getOrderProductsByOrderId(Integer orderId);

    @Select("select product_id from tb_order_product where order_id=#{order_id}")
    List<Integer> getProductIdByOrderId(Integer order_id);

    @Select("select number from tb_order_product where order_id=#{order_id} and product_id=#{product_id}")
    Integer getNumberOfProduct(Integer order_id, Integer product_id);
}
